import Table_Props from "./table"
import List from "./List"
import "./index.css"
import {useState} from"react";
import PropTypes from "prop-types"
const Index_table = () => {
    const [listsss,ChangeList] =useState([
            {
                data:"2022-12-8",
                titile:"我的老家",
                chck:"A",
            },
            {
                data:"2022-12-8",
                titile:"我的老家",
                chck:"B",
            },
            {
                data:"2022-12-8",
                titile:"我的老家",
                chck:"C",
            },
        ]
    )
    //更改数据
   const ChangeAddlist=(obj)=>{
       console.log(obj);
       let nTodoList =[...listsss]
        nTodoList.push(obj)
        ChangeList(nTodoList)
   }
    
    //页面
    return (
        < >
            <div className="index_table_max">
                <h4>表单作业练习，之传参数的表单</h4>
                <Table_Props ChangeAddlist={ChangeAddlist}/>
                <List list_num={listsss}/>                    
            </div>

        </>
    )
}
// Index_table.propTypes = { list_num: PropTypes.array.isRequired} 

export default Index_table